package com.jhy.study2.singleton;

/**
 * @author: robert
 * @description: 懒汉式单例模式（需要的时候创建）
 * @date: 2021/8/22 15:53
 * @return
 */


public class SingletonClass2  {
     private static SingletonClass2 obj = null;
     private SingletonClass2(){}

     public static SingletonClass2 getInstance(){
         if(obj == null){
             obj = new SingletonClass2();
         }
         return obj;
     }
}
